import javax.swing.*;
import java.util.*;

public class Guid extends JFrame{
    public Guid() {
        List<String> puks = new ArrayList<>();
        int q=0;
        int f=0;
        for (int i = 0; i < 4; i++) {
            q=i+1;
            for (int j = 0; j < 13; j++) {
                f=j+3;
                String a = "/images/" + f + "_" + q + ".jpg";
                puks.add(a);
            }
        }
        puks.add("/images/16_1.jpg");
        puks.add("/images/17_1.jpg");
        Collections.shuffle(puks);
        List player1 = puks.subList(0,17);
        List player2 = puks.subList(17,34);
        List player3 = puks.subList(34,51);
        List base = puks.subList(51,54);
        String[] arr1= (String[]) player1.toArray(new String[player1.size()]);
        String[] arr2= (String[]) player2.toArray(new String[player2.size()]);
        String[] arr3= (String[]) player3.toArray(new String[player3.size()]);
        String[] dp= (String[]) base.toArray(new String[base.size()]);
        this.setLayout(null);
        for (int i=0;i<arr1.length;i++){
            Icon btnImg = Utill.getIcon(arr1[i]);
            JButton imageBtn = new JButton(btnImg);
            imageBtn.setBounds(50,580-(i*30),105,150);
            this.add(imageBtn);
        }
        for (int i=0;i<arr2.length;i++){
            Icon btnImg = Utill.getIcon(arr2[i]);
            JButton imageBtn = new JButton(btnImg);
            imageBtn.setBounds(945,580-(i*30),105,150);
            this.add(imageBtn);
        }
        for (int i=0;i<dp.length;i++){
            Icon btnImg = Utill.getIcon(dp[i]);
            JButton imageBtn = new JButton(btnImg);
            imageBtn.setBounds(500-(i*30),10,105,150);
            this.add(imageBtn);
        }
        for (int i=0;i<arr3.length;i++){
            Icon btnImg = Utill.getIcon(arr3[i]);
            JButton imageBtn = new JButton(btnImg);
            imageBtn.setBounds(730-(i*30),700,105,150);
            this.add(imageBtn);
        }

        JButton imageBtn = new JButton("开始");
        imageBtn.setBounds(480,380,50,50);
        this.add(imageBtn);
// 设置窗口大小
        this.setSize(1100,2000);
        // 设置窗体的标题文字
        this.setTitle("测试窗口");
        // 设置窗体居中
        this.setLocationRelativeTo(null);
        // 设置窗口关闭时程序结束
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        // 设置窗体可见
        this.setVisible(true);
    }
    public static void main(String[] args) {
        new Guid();
    }
}
